﻿@model EnetaMvc.ApplicationServices.Dto.EventDto
@using System.Configuration;
@{
    ViewBag.Title = Model.Title;
    Layout = "~/Views/Shared/_EventLayout.cshtml";
}
<div id="content" class="urituste-calendar">
    <span class="content-top">&nbsp;</span>
	<div class="content-main">
        <div class="content-txt">
	        <!--calendar-head start-->
	        <div class="calendar-head">
		        <div class="calendar-head-main">
			        <h2><a href="@Url.Content("~/events/")">@Resources.EnetaMvc.Events</a></h2>
			        @*<ul class="small-menu">
				        <li class="first-link"><a href="#">Eelmine</a></li>
				        <li class="last-link"><a href="#">Järgmine</a></li>
			        </ul>*@
		        </div>
		        <a class="event-banner" href="#"><img alt="image" src="@Url.Content("~/images/img-50.jpg")" width="633" height="98" /></a>
		        @*<div class="slide-block">
			        <div class="calendar-title"> <a href="javascript:;" class="toggle">Sündmuste kalender</a> </div>
			        <div id="block" style="display: none;">
				        <div>
					        <div class="calendar-main"> <img alt="image" src="@Url.Content("~/images/img-38.gif")" width="633" height="172" /> </div>
				        </div>
			        </div>
		        </div>*@
	        </div>

            <div class="comentaries-area">
		        <h2>@Model.Title</h2>
		        <!--comentaries-area-holder start-->
		        <div class="comentaries-area-holder">
			        <!--ulevaade-box start-->
			        <div class="ulevaade-box">
				        <div class="ulevaade">
					        <h6>@Resources.EnetaMvc.EventOverview</h6>
					        <ul>
						        <li class="event-date">
							        <div class="ulevaade-title"> 
                                        <span>@Resources.EnetaMvc.EventDateLabel</span> 
                                        <strong>
                                            @Model.StartDate.Value.ToShortDateString()
                                            @if (Model.StartDate.Value.Date != Model.EndDate.Value.Date)
                                            { 
                                                <text> - </text>@Model.EndDate.Value.Date
                                            }
                                        </strong> 
							        </div>
						        </li>
						        <li class="time">
							        <div class="ulevaade-title">
                                        <span>@Resources.EnetaMvc.EventTimeLabel</span>
                                        <strong>@Model.StartDate.Value.ToShortTimeString() - @Model.EndDate.Value.ToShortTimeString()</strong>
							        </div>
						        </li>
						        <li class="place">
							        <div class="ulevaade-title"> <span>@Resources.EnetaMvc.EventVenueName</span> <strong><a href="@Model.VenueMapUrl">@Model.VenueName</a></strong> </div>
						        </li>
						        <li class="target">
							        <div class="ulevaade-title">
                                        <span>@Resources.EnetaMvc.EventTargetAudience</span>
                                        <strong>@string.Join(", ",Model.TargetAudiences.Select(e => e.Name).ToArray())</strong>
							        </div>
						        </li>
                                @if(Model.TechnicalLevel.HasValue)
                                {
						            <li class="level">
							            <div class="ulevaade-title"> <span>@Resources.EnetaMvc.EventTechnicalLevel</span> <strong><a href="#">@Model.TechnicalLevel.Value</a></strong> </div>
						            </li>
                                }
					        </ul>
					        <div class="slides-vs-demo"> @Resources.EnetaMvc.EventSlides  <strong>@Model.PercentOfSlides / @Model.PercentOfDemos</strong> @Resources.EnetaMvc.EventDemos </div>
				        </div>
			        </div>
			        <!--ulevaade-box end-->
			        @(new MvcHtmlString(Model.Body))
		        </div>

                @Html.TagsForList(Model.Tags, true)

                @if(User.IsInRole("Administrator"))
                {
                    <p>&nbsp;</p>
                    <form action="@Url.Action("ContentAction", new { id = Model.Id })" method="get">
                    @Html.Partial("_TagEditor", Model.Tags)
      
                    <div class="enter-information">
                        <fieldset>
                            <div class="info-row">
                                <div class="title">
                                    <h5>@Resources.EnetaMvc.PublishState</h5>
                                </div>
                                <div class="information-main">
                                    <span>@Model.PublishStateName</span>
                                </div>
                            </div>
                            <div class="info-row">
                                <div class="title">
                                    <h5>Keeldumise põhjus</h5>
                                </div>
                                <div class="information-main">
                                    <textarea rows="5" cols="20" name="comment"></textarea>
                                </div>
                            </div>
                            <div class="submit">
                                <input type="submit" value="@Resources.EnetaMvc.Reject" name="actionName" />
                                <input type="submit" value="@Resources.EnetaMvc.Approve" name="actionName" />
                                <input type="submit" value="@Resources.EnetaMvc.Edit" name="actionName" />
                            </div>
                        </fieldset>
                    </div>
                    </form>
                    <p>&nbsp;</p>
                }

                <ul class="registreeru-links" id="jump-reg-1">
                    <li class="event"><em>@Model.StartDate.Value.Date.ToShortDateString()</em> @Model.Title</li>
                    @if(Model.RegistrationEndDate < DateTime.Now)
                    {
                        <li class="reg-ended"> @Resources.EnetaMvc.EventRegistrationIsOver </li>
                    }
                    else if (Model.Seats <= Model.AttendeesAtRealEvent.Length + Model.AttendeesAtVirtualEvent.Length)
                    { 
                        <li class="reg-ended"> @Resources.EnetaMvc.EventIsSoldOut </li>
                    }
                    else if (Session["UserId"] == null || (Session["UserId"]!= null
                        && Model.AttendeesAtRealEvent.FirstOrDefault(a => a.UserId == (long)Session["UserId"]) == null
                        && Model.AttendeesAtVirtualEvent.FirstOrDefault(a => a.UserId == (long)Session["UserId"]) == null))
                    {                        
                        <li class="btn-link"> <a class="btn-link" href="@Url.Action("RegisterToEvent", new { id = Model.Id, realEvent = true })"> <span>&nbsp;</span> <strong>@Resources.EnetaMvc.RegisterToEventButtonTitle</strong> <em>&nbsp;</em> </a> </li>
						<li class="btn-link webcast"> <a class="btn-link" href="@Url.Action("RegisterToEvent", new { id = Model.Id, realEvent = false })"> <span>&nbsp;</span> <strong>@Resources.EnetaMvc.RegisterToVirtualEventButtonTitle</strong> <em>&nbsp;</em> </a> </li>
                    }
                    else
                    { 
                        <li class="attending">
                        <ul class="regged-user">
                            <li class="blog-foto"> <a title="@Session["UserName"]" href="#"><img alt="@Session["UserName"]" src="@Html.GetProfileUrl((long)Session["UserId"])" width="32" height="32" /></a> </li>
					        <li class="attending">@Session["UserName"],<br />@Resources.EnetaMvc.YouAreRegistered</li>
					        <li> <a class="btn-link btn-link-02" href="@Url.Action("vCard", new { id = Model.Id })"> <span>&nbsp;</span> <strong>@Resources.EnetaMvc.AddEventToCalendarButtonTitle</strong> <em>&nbsp;</em> </a> </li>
					        <li> <a class="btn-link btn-link-03" href="@Url.Action("UnregisterFromEvent", new { id = Model.Id })" title="@Resources.EnetaMvc.CancelEventButtonTooltip"> <span>&nbsp;</span> <strong>@Resources.EnetaMvc.Cancel</strong> <em>&nbsp;</em> </a> </li>
                        </ul>
                        </li>
                    }
					<li class="regged"> <strong>@(new MvcHtmlString(string.Format(@Resources.EnetaMvc.NumberOfAttendeesAtRealEvent,  @Model.AttendeesAtRealEvent.Length)))</strong>
                        <ul>
                            @foreach(var attendee in Model.AttendeesAtRealEvent)
                            {
                                <li><a title="@attendee.UserName" href="@Url.Content("~/profiles/details/" + attendee.UserId)"><img alt="@attendee.UserName" src="@Html.GetProfileUrl(attendee.UserId)" width="32" height="32" /></a></li>
                            }
                        </ul>
                    </li>
                    <li class="regged webcast"> <strong>@(new MvcHtmlString(string.Format(@Resources.EnetaMvc.NumberOfAttendeesAtVirtualEvent,  @Model.AttendeesAtVirtualEvent.Length)))</strong>
                        <ul>
                            @foreach(var attendee in Model.AttendeesAtVirtualEvent)
                            {
                                <li><a title="@attendee.UserName" href="@Url.Content("~/profiles/details/" + attendee.UserId)"><img alt="@attendee.UserName" src="@Html.GetProfileUrl(attendee.UserId)" width="16" height="16" /></a></li>
                            }
                        </ul>
                    </li>
                </ul>

                @{ Html.RenderPartial("_Comments", Model.Comments); }
            </div>

                
            @if(User.Identity.IsAuthenticated)
            {
                Html.RenderPartial("_AddComment", Model.Id);
            }
            else 
            {
                <div class="lisa-kommentaar not">
                    <div class="slide-box wide">
	                    <div class="slide-box-center">
		                    <div class="slide-box-bottom"> <a class="close" href="#">@Resources.EnetaMvc.Close</a>
			                    <div>
				                    <p><a href="@Url.Content("~/login")">@Resources.EnetaMvc.LogIn</a> @Resources.EnetaMvc.AddYourOpinionAndRegisterToEvent
                                       <a href="@Url.Content("~/login")">@Resources.EnetaMvc.LogIn</a> või <a href="@Url.Content("~/login")">@Resources.EnetaMvc.RegisterSmall</a>.</p>
			                    </div>
		                    </div>
	                    </div>
                    </div>
                </div>
            }

            <div class="blogs-menu">
				<ul>
		        <li><a href="@Url.Content("~/")">@ConfigurationManager.AppSettings["PortalName"]</a></li>
		        <li><a href="@Url.Content("~/events/")">@Resources.EnetaMvc.Events</a></li>
	            </ul>
				@*<ul class="small-menu">
					<li class="first-link"><a href="#">Eelmine</a></li>
					<li class="last-link"><a href="#">Järgmine</a></li>
				</ul>*@
			</div>
        </div>
    </div>
    <span class="content-bottom">&nbsp;</span>
</div>